

<div style="float: left;">
<div class="ui-corner-top side_menu" style="width: 100%;">
	View Profile | 
	<?php 
	echo $student->idno.' '.
		$student->lastname.' '.
		$student->firstname.', '.
		$student->middlename.'. ';
		; ?></div>
<div style="border:1px  solid #286bcc;">
<div>&nbsp;</div>
<div>
<?echo validation_errors();?>
<?if(isset($system_message))echo $system_message;?>

<?php 

	if(!empty($student)):

	
	if(!empty($sections)){
		$sectionAttrib = array('' => 'Select Section...');
	
		foreach($sections as $section){
			$sectionAttrib[$section->id] = $section->section_name;
		}
	}
	else
		$sectionAttrib = array('' => 'No sections available');
?>

	

<?php 
	/***
	Edit Student Information
	***/
	echo form_open('evaluation/enrollee/'.$student->profile_id, array('class' => 'registrar-form'));
?>

<div class="inner-border">
	<?php
$formAttrib = array('class'=> 'registrar-form', 'name' => 'frm_addstudent');
$idNo = $student->idno;
$studentTypeAttrib = array('' => 'Select Student Type...', 'new' => 'New', 'old' => 'Old', 'returnee' => 'Returnee', 'cross' => 'Cross' );

//Account Details
$idNoAttrib = array('name' => 'idno', 'value' => $idNo, 'id' => 'idno', 'readonly' => 'readonly');
$userNameAttrib = array('name' => 'username', 'value' => $idNo, 'id' => 'username', 'readonly' => 'readonly');
$passwordAttrib = array('name' => 'password', 'value' => $idNo, 'id' => 'password', 'readonly' => 'readonly');


if(!empty($levels)){
	$levelAttrib = array('' => 'Select level...');
	foreach($levels as $level){
		$levelAttrib[$level->level_id] = strtoupper($level->level_code).' - '.$level->level_desc;
	}
}
else
{
	$levelAttrib = array('' => 'No levels available');
}
$dob = explode('-', $student->dob);
// Personal Information fields
$lNameAttrib = array('name' => 'lastname', 'id' => 'lastname', 'value' => $student->lastname);
$fNameAttrib = array('name' => 'firstname', 'id' => 'firstname', 'value' => $student->firstname);
$mNameAttrib = array('name' => 'middlename', 'id' => 'middlename', 'value' => $student->middlename);
$genderAttrib = array('' => 'Select Gender...', 'male' => 'Male', 'female' => 'Female' );
$civilStatusAttrib = array('' => 'Select Civil Status...', 'single' => 'Single', 'married' => 'Married', 'divorced' => 'Divorced' );
$dobAttrib = array('name' => 'dob', 'id' => 'dob', 'value' => $dob[1].'/'.$dob[2].'/'.$dob[0], 'class' => 'datepicker');
$pobAttrib = array('name' => 'pob', 'id' => 'pob', 'value' => $student->pob);
$ageAttrib = array('name' => 'age', 'id' => 'age', 'value' => $student->age);
$disabilityAttrib = array('name' => 'disability', 'id' => $student->disability);
$nationalityAttrib = array('name' => 'nationality', 'id' => 'nationality', 'value' => $student->nationality);
$religionAttrib = array('name' => 'religion', 'id' => 'religion', 'value' => $student->religion);
$contactNumberAttrib = array('name' => 'contact_no', 'id' => 'contact_no', 'value' => $student->contact_no);
$emailAttrib = array('name' => 'email', 'id' => 'email', 'value' => $student->email);
$presentAddressAttrib = array('name' =>'present_address', 'id' => 'present_address', 'value' => $student->present_address);
$fatherNameAttrib = array('name' => 'fathername', 'id' => 'fathername', 'value' => $student->fathername);
$fatherOccupationAttrib = array('name' => 'father_occupation', 'id' => 'father_occupation', 'value' => $student->father_occupation);
$fatherContactAttrib = array('name' => 'father_contact_no', 'id' => 'father_contact_no', 'value' => $student->father_contact_no);
$motherNameAttrib = array('name' => 'mothername', 'id' => 'mothername', 'value' => $student->mothername);
$motherOccupationAttrib = array('name' => 'mother_occupation', 'id' => 'mother_occupation', 'value' => $student->mother_occupation);
$motherContactAttrib = array('name' => 'mother_contact_no', 'id' => 'mother_contact_no', 'value' => $student->mother_contact_no);
$parentAddressAttrib = array('name' => 'parent_address', 'id' => 'parent_address', 'value' => $student->parent_address);
$guardianNameAttrib = array('name' => 'guardian_name', 'id' => 'guardian_name', 'value' => $student->guardian_name);
$relationshipAttrib = array('name' => 'relationship', 'id' => 'relationship', 'value' => $student->relationship);
$guardianContactAttrib = array('name' => 'guardian_contact_no', 'id' => 'guardian_contact_no', 'value' => $student->guardian_contact_no);
$guardianAddressAttrib = array('name' => 'guardian_address', 'id' => 'guardian_address', 'value' => $student->guardian_address);

// Last school attended
$lSchoolNameAttrib= array('name' => 'last_school_name', 'id' => 'last_school_name', 'value' => $student->last_school_name);
$lSchoolAddressAttrib = array('name' => 'last_school_address', 'id' => 'last_school_address', 'value' => $student->last_school_address);
$lSchoolLevelAttrib = array('name' => 'last_school_level', 'id' => 'last_school_level', 'value' => $student->last_school_level);
$lSchoolYearAttrib = array('name' => 'last_school_year', 'id' => 'last_school_year', 'value' => $student->last_school_year);

?>

<table class="blue"><tbody><tr><th colspan="4" align="center">Student Enrollment Data</th></tr>
<tr>
	<td>
	<?php
        echo form_label('IDNO', 'idno');
        echo form_input($idNoAttrib);
        echo form_hidden('aprofile_id', $student->profile_id);
		echo form_hidden('enrollee_id', $student->enrollee_id);		
    ?>
    </td>
    <td>
    <?php
		echo form_label('Student type <strong>*</strong>', 'student_type');
		echo form_dropdown('student_type', $studentTypeAttrib, $student->student_type);
	?>
    </td>
    <td>
    <?php
		echo form_label('School Year:', 'sy_from');
		echo 'From: '.form_input(array('name'=>'sy_from', 'value' => $student->sy_from, 'id' => 'sy_from', 'size' => 5)).' - ';
		echo form_input(array('name'=>'sy_to', 'value' => $student->sy_to, 'id' => 'sy_to', 'size' => 5));
	?>
  	</td>
</tr>
			
<tr>
    <td>
  	<?php
		echo form_label('Level <strong>*</strong>', 'year_level_id');
		echo form_dropdown('level_id', $levelAttrib, $student->level_id);
	?>
	</td>
    <td colspan="2">
    <?php
		echo form_label('Section assignment', 'section_id');
		echo form_dropdown('section_id', $sectionAttrib, $student->section_id);		
	?>
    </td>
</tr></tbody></table>

<table class="blue"><tbody><tr><th colspan="2" align="center">Student Personal Data</th></tr>
        <tr>
        <td>
        <?php
			echo form_label('Last Name <strong>*</strong>', 'lastname');
			echo form_input($lNameAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('First Name <strong>*</strong>', 'firstname');
			echo form_input($fNameAttrib);
		?>
        </td>
        </tr>


        <tr>
        <td>
        <?php
			echo form_label('Middle Name <strong>*</strong>', 'middlename');
			echo form_input($mNameAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Gender <strong>*</strong>', 'gender');
			echo form_dropdown('gender', $genderAttrib, $student->gender);
		?>
        </td>
        </tr>


        <tr>
        <td>
        <?php
			echo form_label('Civil Status <strong>*</strong>', 'civilstatus');
			echo form_dropdown('civilstatus', $civilStatusAttrib, $student->civilstatus);
		?>
        </td>
  		<td>
    	<?php
			echo form_label('Date of Birth <strong>*</strong>', 'dob');
			echo form_input($dobAttrib);
		?>
        </td>
        </tr>

        <tr>
        <td>
        <?php
			echo form_label('Place of Birth <strong>*</strong>', 'pob');
			echo form_input($pobAttrib);
		?>	
   		</td>
	  	<td>
    	<?php
			echo form_label('Age <strong>*</strong>', 'age');
	    	echo form_input($ageAttrib);
		?>
        </td>
        </tr>

        <tr>
        <td>
    	<?php
			echo form_label('Disability', 'disability');
	    	echo form_input($disabilityAttrib);
		?>
    	</td>
        <td>
    	<?php
			echo form_label('Nationality <strong>*</strong>', 'nationality');
	    	echo form_input($nationalityAttrib);
		?>
        </td>
        </tr>


        <tr>
        <td>
    	<?php
			echo form_label('Religion <strong>*</strong>', 'religion');
			echo form_input($religionAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Contact Number <strong>*</strong>', 'contact_no');
			echo form_input($contactNumberAttrib);
		?>
        </td>
        </tr>

        <tr>
        <td>
    	<?php
			echo form_label('Email <strong>*</strong>', 'email');
			echo form_input($emailAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Present Address <strong>*</strong>', 'present_address');
	    	echo form_input($presentAddressAttrib);
		?>
        </td>
        </tr>

        <tr>
        <td>
        <?php
			echo form_label('Father\'s Name <strong>*</strong>', 'fathername');
			echo form_input($fatherNameAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Occupation <strong>*</strong>', 'father_occupation');
	    	echo form_input($fatherOccupationAttrib);
		?>
        </td>
        </tr>

        <tr>
        <td>
       <?php
			echo form_label('Contact Number <strong>*</strong>', 'father_contact_no');
	    	echo form_input($fatherContactAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Mother\'s Name <strong>*</strong>', 'mothername');
			echo form_input($motherNameAttrib);
		?>
        </tr>

        <tr>
        <td>
        <?php
			echo form_label('Occupation <strong>*</strong>', 'mother_occupation');
	    	echo form_input($motherOccupationAttrib);
		?>
        </td>
        <td>
    	<?php
			echo form_label('Contact Number <strong>*</strong>', 'mother_contact_no');
	    	echo form_input($motherContactAttrib);	
		?>
        </td>
        </tr>

        <tr>
        <td>
        <?php
			echo form_label('Parent\'s Address <strong>*</strong>', 'parent_address');
	    	echo form_input($parentAddressAttrib);	
		?>
        </td>

        <td>
    	<?php
			echo form_label('Guardian Name <strong>*</strong>', 'guardian_name');
	    	echo form_input($guardianNameAttrib);	
		?>
        </td>
        </tr>

        <tr>
        <td>
       <?php
			echo form_label('Relationship <strong>*</strong>', 'relationship');
	    	echo form_input($relationshipAttrib);	
		?>
        </td>
        <td>
    	<?php
			echo form_label('Contact Number <strong>*</strong>', 'guardian_contact_no');
	    	echo form_input($guardianContactAttrib);	
		?>
    	</td>
        </tr>

        <tr>
        <td colspan="2">
        <?php
			echo form_label('Guardian Address <strong>*</strong>', 'guardian_address');
	    	echo form_input($guardianAddressAttrib);	
		?>
        </td>
        </tr>

</tbody></table>
<table class="blue">
        <tbody><tr>
                <th colspan="5" align="center">Last School Attended</th>
        </tr>
       
       	<tr>
        <td>
        <?php
			echo form_label('School Name <strong>*</strong>', 'last_school_name');
			echo form_input($lSchoolNameAttrib);	
		?>
        </td>
        <td>
       	<?php
			echo form_label('School Address <strong>*</strong>', 'last_school_address');
			echo form_input($lSchoolAddressAttrib);	
		?>
        </td>
        <td>
        <?php
			echo form_label('Level <strong>*</strong>', 'last_school_level');
			echo form_input($lSchoolLevelAttrib);
		?>
        </td>
        <td>
        <?php
			echo form_label('Year<strong>*</strong>', 'last_school_year');
			echo form_input($lSchoolYearAttrib);	
		?>
        </td>
        </tr>
        
        
	
</tbody></table>

<div class="input-block">
	<a href="<?=site_url('evaluation/search');?>" class="btn">Back</a>
 	<?php echo form_submit('update', 'Update');?>
</div>
<br/><h3>Subjects</h3><br/>
<table>
   <thead class="tabular-head">
	<tr>
		<th>Subject Code</th>
        <th>Subject Description</th>
        <th></th>
	</tr>
	</thead>
    <?php if(!empty($subjects)):?>
	<tbody class="tabular">
    	    <?php foreach($subjects as $subj):?>
            	<tr>
                	<td><?php echo $subj->subj_code;?></td>
                    <td><?php echo $subj->subj_desc;?></td>
                    <td><a href="<?php echo site_url().'evaluation/remove_subject/'.$subj->enrolled_subjects_id.'/'.$student->profile_id;?>">Remove</a></td>
                </tr>
            <?php endforeach;?>
   <?php else: ?>
   	<tbody>
    	<tr><td colspan="2">No subjects yet</td></tr>
   <?php endif;?>
		    </tbody></table>




</div>

<?php
echo form_close();
?>

</div>
<?php else:?>
Invalid enrollee
<?php endif;?>
<div class="clearfloat"></div>
</div>
<div>&nbsp;</div>
</div>
